<?

class ZendConfigAdapter implements IConfig
{
    private $_componentInstance = null;
    
    public function __construct()
    {}
    
    public function __get($key)
    {
        return $this->_componentInstance->$key;
    }
    
    public function toArray()
    {
        return $this->_componentInstance->toArray();
    }
    
    public function load($type, $file, $section = null)
    {
        switch($type)
        {
            case Config::TYPE_ARRAY :
                $this->_componentInstance = new Zend_Config($file);  
                break;
            case Config::TYPE_INI :
                if(!is_null($section))
                {
                    $this->_componentInstance = new Zend_Config_Ini($file, $section);
                }else
                {
                    $this->_componentInstance = new Zend_Config_Ini($file);
                }
                break;
            case Config::TYPE_JSON :
                break;
            case Config::TYPE_XML :
                if(!is_null($section))
                {
                    $this->_componentInstance = new Zend_Config_Xml($file, $section);
                }else
                {
                    $this->_componentInstance = new Zend_Config_Xml($file);
                }
                break;
            case Config::TYPE_YAML :
                if(!is_null($section))
                {
                    $this->_componentInstance = new Zend_Config_Yaml($file, $section);
                }else
                {
                    $this->_componentInstance = new Zend_Config_Yaml($file);
                }
                break;
            default :
                $this->_componentInstance = new Zend_Config($file);  
                break;
        }
    }
}

?>